package com.example.petback.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebAppConfigurer implements WebMvcConfigurer {
    @Value("${upload.file.location}")
    private String fileLocation;
    @Value("${upload.file.path}")
    private String filePath;
    @Value("${spring.static.location}")
    private String staticLocation;
    @Value("${spring.static.path}")
    private String staticPath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler(filePath).addResourceLocations(fileLocation);
        registry.addResourceHandler(staticPath).addResourceLocations(staticLocation);
        WebMvcConfigurer.super.addResourceHandlers(registry);
    }
}
